<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta content="test/html;charset=UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <link th:href="@{bootstrap/css/bootstrap.css}" rel="stylesheet"/>
    <title>Title</title>
</head>
<body>

<div class="panel panel-primary">
    <div>
        <h3 class="panel-title">访问model</h3>
    </div>
    <div class="panel-body">
        <span th:text="${singlePerson.name}"></span>
    </div>
    <div th:if="${not #lists.isEmpty(people)}">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">列表</h3>
            </div>
            <div class="panel-body">
                <ul class="list-group">
                    <li class="list-group-item" th:each="people:${people}">
                        <span th:text="${people.name}"></span>
                        <span th:text="${people.age}"></span>
                        <button class="btn" th:onclick="'getName(\'' + ${people.name} + '\');'">获得名字</button>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>


<script th:src="@{jquery/jquery-1.8.3.js}" type="text/javascript"></script>
<script th:src="@{bootstrap/js/bootstrap.js}"></script>
<script th:inline = "javascript">
    var single = [[${singlePerson}]];
    console.log(single.name+"/"+single.age)

    function  getName(name) {
        console.log(name);
    }
</script>


</body>
</html>